package ZUOYE0420;

import java.util.Scanner;

public class 作业十三 {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		System.out.println("************************************");
		System.out.println("请选择购买的上坪编号：");
		System.out.println("1.T恤\t2.网球鞋\t3.网球拍");
		System.out.println("************************************\n");
		int a;
		int b;
		double a1 = 0;
		double a2 = 0;
		String c = "y";

		while (c.equals("y")) {
			System.out.print("请输入商品编号：");
			a = in.nextInt();
			if (a < 1 || a > 3) {
				c = "y";
				System.out.println("输入有误");
			} else {
				System.out.print("请输入购买数量：");
				b = in.nextInt();

				switch (a) {
				case 1: {
					a1 = b * 245.0;
					System.out.println("T恤￥245.0\t数量" + b + "\t合计￥" + a1);
					break;
				}
				case 2: {
					a1 = b * 570.0;
					System.out.println("网球鞋￥570.0\t数量" + b + "\t合计￥" + a1);
					break;
				}
				case 3: {
					a1 = b * 180.0;
					System.out.println("网球拍￥180.0\t数量" + b + "\t合计￥" + a1);
					break;
				}
				}

				a2 = a2 + a1;
				System.out.println("是否继续（y/n）:");
				c = in.next();
			}
			if (c.equals("n")) {
				System.out.println("折扣：0.8");
				System.out.println("应付金额：" + a2 * 0.8);
				boolean q = true;
				while (q) {
					System.out.print("实付金额：");
					int w = in.nextInt();
					if (w > a2) {
						System.out.println("找钱：" + (w - a2));
						break;
					} else {
						System.out.println("请重新输入实付金额");

					}
				}
			}

		}
	}
}
